package main

import "fmt"

type Age struct {
	Num int
}
type Human struct {
	Name string
	Age  uint
}

func (age Age) test() {
	age.Num = 11
	fmt.Println("test()", age.Num)
}

func (human Human) speak() {
	fmt.Println(human.Name, "is a good man")
}

func (human *Human) setAge(n uint) {
	(*human).Age = n
}

//方法
func main() {
	var age Age = Age{Num: 29}
	age.test()
	fmt.Println(age.Num)

	Ryan := Human{
		Name: "Ryan",
		Age:  29,
	}
	Ryan.speak()
	Ryan1 := &Human{Name: "Ryan1", Age: 11}
	Ryan.setAge(66)
	fmt.Println(*Ryan1)
	fmt.Println(Ryan)
	fmt.Printf("%p \n", Ryan1)
	fmt.Printf("%p \n", &Ryan)
}
